<template>
    <div ref="chart" style="width: 100%;height: 238px;">

    </div>
</template>
<script>
export default {
  props: {
    title: {
      type: String,
      default: '标题'
    }
  },
  data () {
    return {
    }
  },
  mounted () {
    const myChart = this.$echarts.init(this.$refs.chart);
    const option = {
      title: {
        text: this.title,
        x: 'center',
        y: '10px',
        textStyle: {
          // 文字颜色
          color: '#FFF'
        }
      },
      series: [
        {
          type: 'pie',
          data: [
            {
              value: 335,
              name: '直接访问'
            },
            {
              value: 234,
              name: '联盟广告'
            },
            {
              value: 1548,
              name: '搜索引擎'
            }
          ],
          radius: '50%'
        }
      ]
    };
    myChart.setOption(option);
  },
  computed: {
  },
  methods: {
    // initChart () {
    //   const myChart = this.$echarts.init(this.$refs.chart);
    // }
  }
}
</script>
<style  scoped>

</style>
